<template>
  <div>
    <div
      class="box"
      v-for="item in list"
      :key="item.id"
      @click="$router.push(`/detail/${item.houseCode}`)"
    >
      <div class="left">
        <!-- <img :src="item.houseImg" alt="" /> -->
      </div>
      <div class="right">
        <h4>{{ item.title }}</h4>
        <p>{{ item.desc }}</p>
        <p>{{ item.tags[0] }}</p>
        <p>{{ item.price }}元/月</p>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios";

export default {
  name: "LookFor",
  data() {
    return {
      list: [],
    };
  },
  async created() {
    const res = await axios.get("http://www.xiaoshuaipeng.com:8080/houses");
    console.log(res.data.body.list);
    this.list = res.data.body.list;
  },
};
</script>

<style lang=less scoped>
.box {
  width: 100%;
  height: 150px;
  background: red;
  display: flex;
  border-bottom: 1px solid #000;
}
.left {
  width: 100px;
  height: 150px;
  background: pink;
  text-align: center;
  line-height: 150px;
}
.right h4 {
  margin: 0;
}
</style>
